<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"   
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f = "http://java.sun.com/jsf/core"
      >
    <h:body>
    	
    	<ui:composition template="/template/commonLayout.xhtml">
    	
    		<ui:define name="content">
		<p:messages id="messages" showDetail="true" autoUpdate="true"
		closable="true" />
	<h4>Hours/day</h4>
	<h:form>
		<p:outputLabel for="intervalsByDay" value="Select Day: " />
		<p:calendar id="intervalsByDay" value="#{timeIntervalView.day}"
			pattern="dd/MM/yyyy" locale="de">
			<p:ajax event="dateSelect"
				update="outFactorOne outFactorOnePointFive outDayFormat"
				listener="#{timeIntervalView.getIntervalsByDay()}" />

		</p:calendar>
		<br />
		<br />
		<div align="center">
			<h:outputText id="outDayFormat" value="#{timeIntervalView.day}">
				<f:convertDateTime dateStyle="full" type="date" timeZone="GMT+1" />
			</h:outputText>
		</div>
		<br />
		<br />

		<p:dataTable id="outFactorOne" var="interval"
			value="#{timeIntervalView.intervalService.intervalData.intervalsWithFactorOne}">
			<f:facet name="header">
	            Factor 1:1
	        </f:facet>
			<p:column headerText="Activity">
				<h:outputText value="#{interval.activity}" />
			</p:column>
			<p:column headerText="From">
				<h:outputText value="#{interval.from}">
					<f:convertDateTime pattern="HH:mm" timeZone="GMT+1" />
				</h:outputText>
			</p:column>
			<p:column headerText="To">
				<h:outputText value="#{interval.to}">
					<f:convertDateTime pattern="HH:mm" timeZone="GMT+1" />
				</h:outputText>
			</p:column>
			<p:column headerText="Time">
				<h:outputText value="#{interval.intervalLenghtAsString}">
					<f:convertDateTime pattern="HH:mm" timeZone="GMT+1" />
				</h:outputText>
			</p:column>
			<p:columnGroup type="footer">
				<p:row>
					<p:column footerText="Total" colspan="3" style="text-align:right" />
					<p:column
						footerText="#{timeIntervalView.intervalService.intervalData.timeOfIntervalsWithFactorOneAsString}"
						style="text-align:left" />
				</p:row>
			</p:columnGroup>
		</p:dataTable>
		<br />
		<br />


		<p:dataTable id="outFactorOnePointFive" var="interval"
			value="#{timeIntervalView.intervalService.intervalData.intervalsWithFactorOnePointFive}">
			<f:facet name="header">
	            Factor 1:1,5
	        </f:facet>
			<p:column headerText="Activity">
				<h:outputText value="#{interval.activity}" />
			</p:column>
			<p:column headerText="From">
				<h:outputText value="#{interval.from}">
					<f:convertDateTime pattern="HH:mm" timeZone="GMT+1" />
				</h:outputText>
			</p:column>
			<p:column headerText="To">
				<h:outputText value="#{interval.to}">
					<f:convertDateTime pattern="HH:mm" timeZone="GMT+1" />
				</h:outputText>
			</p:column>
			<p:column headerText="Time">
				<h:outputText value="#{interval.intervalLenghtAsString}" />
			</p:column>
			<p:columnGroup type="footer">
				<p:row>
					<p:column footerText="Total" colspan="3" style="text-align:right" />
					<p:column
						footerText="#{timeIntervalView.intervalService.intervalData.timeOfIntervalsWithFactorOnePointFiveAsString}"
						style="text-align:left" />
				</p:row>
				<p:row>
					<p:column footerText="Total(with factor included)" colspan="3"
						style="text-align:right" />
					<p:column
						footerText="#{timeIntervalView.intervalService.intervalData.timeOfIntervalsWithFactorOnePointFiveCalculatedAsString}"
						style="text-align:left" />
				</p:row>
			
					<p:row>
						<p:column footerText="Total Amount" colspan="3"
							style="text-align:right" />
						<p:column
							footerText="#{timeIntervalView.intervalService.intervalData.sumOfIntervalTimes}"
							style="text-align:left" />
					</p:row>
					<p:row>
						<p:column  colspan="4" styleClass="intervalTable_rowHidden"/>
					</p:row>
					<p:row>
						<p:column footerText="Break" colspan="3" style="text-align:right" />
						<p:column
							footerText="#{timeIntervalView.intervalService.intervalData.breakSumAsString}"
							style="text-align:left"/>
					</p:row>
					<p:row>
						<p:column footerText="Actual Time" colspan="3"
							style="text-align:right" />
						<p:column
							footerText="#{timeIntervalView.intervalService.intervalData.actualTimeAsString}"
							style="text-align:left" />
					</p:row>
					<p:row>
						<p:column footerText="Allocated Time" colspan="3"
							style="text-align:right" />
						<p:column
							footerText="#{timeIntervalView.intervalService.intervalData.allocatedTimeAsString}"
							style="text-align:left" />
					</p:row>
					<p:row>
						<p:column  colspan="4" styleClass="intervalTable_rowHidden"/>
					</p:row>
					<p:row>
						<p:column footerText="Difference" colspan="3"
							style="text-align:right" />
						<p:column
							footerText="#{timeIntervalView.intervalService.intervalData.differenceAsString}"
							style="text-align:left" />
					</p:row>
				</p:columnGroup>
	

		</p:dataTable>


	</h:form>
	</ui:define>    		
    	</ui:composition>
    	
    </h:body>

</html>